home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / suckmods.zip / SUCKMODS.ZIP / suck05 / src / telefrag.qc < prev    next >
Text File  |  1997-05-09  |  2KB  |  62 lines

  1. /*
  2. **
  3. ** _telefrg.qc (Telefrag Code, 1.1)
  4. **
  5. ** Copyright (C) 1996 Johannes Plass
  6. **
  7. ** This program is free software; you can redistribute it and/or modify
  8. ** it under the terms of the GNU General Public License as published by
  9. ** the Free Software Foundation; either version 2 of the License, or
  10. ** (at your option) any later version.
  11. **
  12. ** This program is distributed in the hope that it will be useful,
  13. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ** GNU General Public License for more details.
  16. **
  17. ** You should have received a copy of the GNU General Public License
  18. ** along with this program; if not, write to the Free Software
  19. ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. **
  21. ** Author:   Johannes Plass (plass@dipmza.physik.uni-mainz.de)
  22. **
  23. ** --
  24. ** Sniped by Zoid for ThreeWave Mods, GPL respected
  25. **
  26. */
  27.  
  28. entity() SelectSpawnPoint;
  29.  
  30. entity(entity spot) TelefragSelectSpawnPoint =
  31. {
  32.     local entity e, firstspot;
  33.     local float search_spot;
  34.  
  35.     search_spot = 25;
  36.     firstspot = spot;
  37.  
  38.     while (search_spot) {
  39.         e = findradius(spot.origin, 50);
  40.         if (!e)
  41.             search_spot = 0;
  42.         else {
  43.             local float occupied;
  44.             occupied = 0;
  45.             while (!occupied && !(!e)) {
  46.                 if (e.classname == "player" && e.deadflag == DEAD_NO)
  47.                         occupied = 1;
  48.                 else
  49.                     e = e.chain;
  50.             }
  51.             if (occupied) {
  52.                 spot = SelectSpawnPoint();
  53.                 search_spot = search_spot - 1;
  54.                 if (spot == firstspot)
  55.                         search_spot = 0;
  56.             } else
  57.                 search_spot = 0;
  58.         }
  59.     }
  60.     return (spot);
  61. };
  62.